import request from '@/utils/request'

/**
 * 客流分析查询
 */
// 客流分析展示图
export function getPeopleNumberLineCharts(type, checkType, startTime, endTime, page) {
  const data = { type, checkType, startTime, endTime, page }
  return request({
    url: 'api/v1/backend/read_sense/index',
    method: 'post',
    data
  })
}
// 男女比例环形图
export function getSexPieData(startTime, endTime) {
  const data = { startTime, endTime }
  return request({
    url: 'api/v1/backend/read_sense/gender',
    method: 'post',
    data
  })
}
// 回头客分析环形图
export function getFrequencyAnalysisPieData(startDate, endDate) {
  const data = { startDate, endDate }
  return request({
    url: 'api/v1/backend/frequency_analysis_chart',
    method: 'post',
    data
  })
}
// 客流分析表
export function getPeopleNumberData(type, startTime, endTime, perPage, page){
  const data = {
    type, startTime, endTime, perPage, page
  }
  return request({
    url: 'api/v1/backend/read_sense/list',
    method: 'post',
    data
  })
}

// 抓拍记录
export function getCaptureRecordsData(startTime, endTime, perPage, page){
  const data = {
    startTime, endTime, perPage, page
  }
  return request({
    url: 'api/v1/backend/read_sense/face/flow',
    method: 'post',
    data
  })
}

/**
 * 时段客流分析对比
 */
// 对比图数据
export function getContrastChartsData(type, period, first, second) {
  const data = { type, period, first, second }
  return request({
    url: 'api/v1/backend/read_sense/face/flow_analysis',
    method: 'post',
    data
  })
}

/**
 * 时段客流热力图
 */
export function getRegionalChartsData(startDate, endDate) {
  const data = { startDate, endDate }
  return request({
    url: 'api/v1/backend/face/regional/analysis',
    method: 'post',
    data
  })
}


/**
 * 节假日活动分析
 */
// 获取今年假日列表
export function getThisYearHolidayList(year) {
  const data = { year }
  return request({
    url: 'api/v1/backend/holiday/list',
    method: 'post',
    data
  })
}
// 获取往年节假日列表
export function getFormerHolidayList(year) {
  const data = { year }
  return request({
    url: 'api/v1/backend/holiday/list',
    method: 'post',
    data
  })
}
// 节假日对比图
export function getHolidayChartsData(type, period, first, second){
  const data = { type, period, first, second }
  return request({
    url: 'api/v1/backend/read_sense/face/flow_analysis_two',
    method: 'post',
    data
  })
}


/**
 * 回头客
 */
// 获取 回头客概况
export function getFrequentSummary(date){
  const data = { date }
  return request({
    url: 'api/v1/backend/frequent_summary',
    method: 'post',
    data
  })
}
// 回访活跃度分析 上次到访间隔天数分布
export function getFrequentActivities(date) {
  const data = { date }
  return request({
    url: 'api/v1/backend/frequent_activities',
    method: 'post',
    data
  })
}
// 近一周高频回头客来访时段分布
export function getG2AntvFrequentTable(date) {
  const data = { date }
  return request({
    url: 'api/v1/backend/frequent_table',
    method: 'post',
    data
  })
}
// 回头客/新客分布走势分析
export function getFrequencyDistributions(date, type){
  const data = { date,type }
  return request({
    url: 'api/v1/backend/frequency_distributions',
    method: 'post',
    data
  })
}
